//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class ObjectStyleDefaults : IOfficeXmlSerializable
    {
        private DefaultShapeDefinition lnDef;
        private DefaultShapeDefinition spDef;
        private DefaultShapeDefinition txDef;

        public DefaultShapeDefinition SpDep
        {
            get { return spDef; }
            set { spDef = value; }
        }

        public DefaultShapeDefinition LnDef
        {
            get { return lnDef; }
            set { lnDef = value; }
        }

        public DefaultShapeDefinition TxDef
        {
            get { return txDef; }
            set { txDef = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("objectDefaults"))
            {
                spDef = c.ReadOptionalElementAs<DefaultShapeDefinition>("spDef");
                lnDef = c.ReadOptionalElementAs<DefaultShapeDefinition>("lnDef");
                txDef = c.ReadOptionalElementAs<DefaultShapeDefinition>("txDef");
                c.WarnIf("ext");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("objectDefaults"))
            {
                c.WriteOptionalElementAs(spDef, "spDef");
                c.WriteOptionalElementAs(lnDef, "lnDef");
                c.WriteOptionalElementAs(txDef, "txDef");
                c.WarnIf("ext");
            }
        }

        #endregion
    }
}